package com.hducms.cms.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hducms.cms.dao.DynamicDao;
import com.hducms.cms.entity.assist.Dynamic;
import com.hducms.cms.service.DynamicPasswordService;

@Service
@Transactional
public class DynamicPasswordServiceImpl implements DynamicPasswordService {

	@Override
	public void save(Integer userId, String identifier,String randCode, Date dt) {
		Dynamic dynamic = new Dynamic();
		dynamic.setUserId(userId);
		dynamic.setIdentifier(identifier);
		dynamic.setRandcode(randCode);
		dynamic.setCreatTime(dt);
		dao.save(dynamic);
	}

	@Autowired
	DynamicDao dao;

	@Override
	public Dynamic findByUserId(Integer userid) {
		Dynamic dynamic = new Dynamic();
		dynamic = dao.findByUserId(userid);
		return dynamic;
	}

	@Override
	public void deleteById(Integer userid) {
		dao.deleteById(userid);
	}
}
